<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>v-bind:class</title>
    <script src="https://cdn.bootcss.com/vue/2.4.4/vue.js"></script>

  <style>
    .active{
      color: darkred;
      font-weight: bold;
    }
    .big{
      font-size: 30px;
      font-weight: bolder;
    }
  </style>
</head>
<body>
  <h3>为html标签绑定样式单class对象</h3>
  <div id="myApp">
    <p v-bind:class="myClass">红色{{sizeStr}}文本</p>
    <br>
    <button @click="btnClick">改变class</button>
  </div>
  <script>
    var myApp = new Vue({
      el: '#myApp',
      data: {
        size:true,
        sizeStr:'大',
        myClass: {
          active: true,
          big: true
        },
      },
      methods: {
        btnClick: function () {
          this.size = !this.size;
          (this.size==true)? this.sizeStr = '大':this.sizeStr = '小'
          this.myClass.big = !this.myClass.big;
        }
      }
    })
  </script>
</body>
</html>